//
//  NetWorkerManager+SignRelated.m
//  PublicInfo
//
//  Created by enghou on 2018/2/2.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "NetWorkerManager+SignRelated.h"
#import "SignItemModel.h"
#define kSignAction @"/api/integralManage/userSignIn/signIn"

#define kSignRecordWithMonth @"/api/integralManage/userSignIn/getSignInCount"

#define kGetMyScore @"/api/integralManage/userIntegral/getMyIntegral"
@implementation NetWorkerManager (SignRelated)

-(void)signActionSuccessBlock:(completeBlock)block failBlock:(failBlock)fail{
    [self postWithPath:@"/mobile/comprehensiveGovernance/signMobile/addSign.action" parameter:nil completeBlock:^(NSDictionary *source) {
        BaseModel *model = [[BaseModel alloc]initWithSourceDict:source];
        block(model);
    } failBlock:^(NSInteger code) {
        fail(code);
    }];
}

-(void)signMonthListWithDate:(NSString *)date successBlock:(completeBlock)block failBlock:(failBlock)fail{
    [self getWithPath:@"/mobile/comprehensiveGovernance/signMobile/findSignByYearAndMonthAndUserId.action" parameter:nil completeBlock:^(NSDictionary *source) {
        SignModel *model = [[SignModel alloc]initWithSourceDict:source];
        if (model.success) {
            NSArray *data = model.data[@"data"];
            NSMutableArray *array = [NSMutableArray array];
            for (NSString *str in data) {
                NSString *day = [str substringFromIndex:8];
                SignItemModel *model = [[SignItemModel alloc]init];
                model.day = [day integerValue];
                [array addObject:model];
            }
            model.list = array;
        }
        block(model);
    } failBlock:^(NSInteger code) {
        fail(code);
    }];
}



-(void)getMyScoreSuccessBlock:(completeBlock)block failBlock:(failBlock)fail{
//    [self getWithPath:@"/mobile/comprehensiveGovernance/signMobile/findSignByYearAndMonthAndUserId.action" parameter:nil completeBlock:^(NSDictionary *source) {
//        BaseModel *model = [[BaseModel alloc]initWithSourceDict:source];
//        block(model);
//    } failBlock:^(NSInteger code) {
//        fail(code);
//    }];
}





@end
